/**
  ******************************************************************************
  * @file    main.c
  * @author  armwind
  * @version V1.0
  * @date    2019.10.1
  * @brief   主程序,代码学习使用。
  * @宝贝链接：https://item.taobao.com/item.htm?spm=a2oq0.12575281.0.0.50111debxjgygH&ft=t&id=626242045207
  ******************************************************************************
  */
#include "led.h"
#include "usart.h"
#include "log.h"
#include "eeprom.h"
/**
  * @brief  Main program.
  * @param  None
  * @retval
  */
//如果日志等级大于LOG_DEBUG，则会打印该日志，反之不会。
#define LOG_LOCAL_LEVEL LOG_DEBUG
#define TAG  "MAIN:"

int main(void)
{
  /* Add your application code here
   *
   */
    delay_init();
    usart_config(1,9600); //串口1波特率9600
    //usart_config(2,9600);
    led_init();
    ATMELH909_Init();
    ATMELH909_WriteByte(0x0038,0xaa);
    uint8_t rd_dat = ATMELH909_ReadByte(0x0038);
    if (0xaa == rd_dat)
        LOGI("eeprom read success!");
    else
        LOGE("eeprom read failed!read_dat:0x%x",rd_dat);

    uint16_t addr = 0;
    for( addr = 0; addr < 66; addr++) {
       ATMELH909_WriteByte(addr,addr);
       rd_dat = ATMELH909_ReadByte(addr);
       LOGE("addr:0x%x,read_dat:0x%x",addr,rd_dat);
    }

  /* Infinite loop */
    while (1) {
            LOGI("main is alive!");
            delay_ms (2000);
    }
}
/************************ (C) COPYRIGHT weiduwulian*****END OF FILE****/
